package com.yipinhouse.backstage.app.apiImpl;

import cn.hutool.core.bean.BeanUtil;
import com.yipinhouse.backstage.client.LoanManageWebClient;
import com.yipinhouse.backstage.client.param.AddLoanRecordWebParam;
import com.yipinhouse.common.result.Result;
import com.yipinhouse.loan.client.LoanManageClient;
import com.yipinhouse.loan.client.param.AddLoanRecordParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@Slf4j
@RequestMapping("backstage")
public class LoanManageWebApiImpl implements LoanManageWebClient {

    @Resource
    private LoanManageClient loanManageClient;

    @Override
    public Result addLoanRecord(AddLoanRecordWebParam param) {
        AddLoanRecordParam addLoanRecordParam = BeanUtil.copyProperties(param, AddLoanRecordParam.class);
        Result result = loanManageClient.addLoanRecord(addLoanRecordParam);
        return result;
    }
}
